/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: xwl
 * Date: 2023-05-20
 * Time: 15:58
 */
public class Main {
    public static void main(String[] args) {
        TraversalBinaryTree binaryTree = new TraversalBinaryTree();
        TraversalBinaryTree.TreeNode root = binaryTree.createTree();
        // 调用遍历
        binaryTree.preOrder(binaryTree.root);
        System.out.println();
        binaryTree.inOrder(root);
        System.out.println();
        binaryTree.postOrder(root);

        // 分隔
        System.out.println();

        // 调用获取树的节点个数方法
        int ret = binaryTree.size(root);
        System.out.println(ret);
        // 调用获取树的叶子节点个数的方法
        int ret2 = binaryTree.getLeafNodeCount(root);
        System.out.println(ret2);
        // 调用获取第K层的节点的个数
        int ret3 = binaryTree.getKLevelNodeCount(root,3);
        System.out.println(ret3);
        // 调用获取树的高度方法
        int ret4 = binaryTree.getTreeHight(root);
        System.out.println(ret4);
        // 调用检测值为value的元素是否存在
        TraversalBinaryTree.TreeNode ret5 = binaryTree.find(root,'E');
        System.out.println(ret5.val);
        // 调用二叉树的层序遍历
        binaryTree.levelOrder(root);

    }
}
